
#ifndef INPUTMANAGERCOMPONENT_H_
#define INPUTMANAGERCOMPONENT_H_

#include "Game/GameComponent.h"
#include "Game/GameTime.h"
#include "Game/Game.h"
#include "Input\Input.h"

namespace CasaEngine
{

	class LIBRARY_FRAMEWORK_EXPORT InputManagerComponent :
		public IGameComponent
	{
	public:
		InputManagerComponent(Game* pGame_);
		~InputManagerComponent();

		void Initialize();
		void Update(const GameTime& gameTime_);

		bool IsKeyDown(Key::Code KeyCode) const;
		bool IsKeyJustDown(Key::Code KeyCode) const;
		bool IsMouseButtonDown(Mouse::Button Button) const;
		bool IsMouseButtonJustDown(Mouse::Button Button) const;
		bool IsJoystickButtonDown(unsigned int JoyId, unsigned int Button) const;
		bool IsJoystickButtonJustDown(unsigned int JoyId, unsigned int Button) const;

		float GetJoystickAxis(unsigned int JoyId, Joy::Axis Axis) const;

		int GetDeltaMouseX() const;
		int GetDeltaMouseY() const;
		int GetMouseX() const;
		int GetMouseY() const;
		int GetMouseWheel() const;

	private:
		bool  m_LastFrameKeys[Key::Count];
		bool  m_LastFrameMouseButtons[Mouse::ButtonCount];
		int   m_LastFrameMouseX;
		int   m_LastFrameMouseY;
		int   m_LastFrameMouseDeltaX;
		int   m_LastFrameMouseDeltaY;
		int   m_LastFrameMouseWheel;
		bool  m_LastFrameJoystickButtons[Joy::Count][Joy::ButtonCount];
		float m_LastFrameJoystickAxis[Joy::Count][Joy::AxisCount];

		Input* m_pInput;
	};

} // namespace CasaEngine

#endif // INPUTMANAGERCOMPONENT_H_
